﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Utilities;

namespace MaHoaUngDung
{
    public partial class ConfirmPassFrm : DevComponents.DotNetBar.Office2007Form
    {
        private User user;
        public ConfirmPassFrm(User user)
        {
            InitializeComponent();
            this.user = user;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            errorProvider1.Clear();
            if (tbPassPhrase.Text.CompareTo(string.Empty) == 0)
            {
                errorProvider1.SetError(tbPassPhrase, "Làm ơn nhập passphrase!");
                return;
            }

            UserList ul = Program.ListUser;
            if (ul.CheckUser(user.Email, tbPassPhrase.Text.Trim()))
            {
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
                MessageBox.Show("Passphrase nhập không đúng!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
